<ol class="breadcrumb">
    <li><a href="#">系统中心</a></li>
    <li>用户管理</li>
</ol>
<div class="panel panel-default">
    <div class="panel-heading">
        <span class="icon-group icon-large"></span>
        <span class="panel-title">用户列表</span>
        <% if(session.permissionMap[2001]){ %>
        <a href="/user/create" class="pull-right btn btn-success btn-sm" style="margin-top: -3px;">
            <span class="glyphicon glyphicon-plus"></span>
            <span>新增</span>
        </a>
        <% } %>
    </div>
    <div class="table-responsive">
        <table class="table table-hover table-striped">
            <thead>
            <tr>
                <th>用户名</th>
                <th>用户密码</th>
                <th>用户公司</th>
                <th>联系人</th>
                <th>联系电话</th>
                <th>操作</th>
            </tr>
            </thead>
            <tfoot>
            <tr>
                <td colspan="7">
                    <nav class="twbsPagination"></nav>
                </td>
            </tr>
            </tfoot>
            <tbody>
            <% for(var i = 0;i < datas.length;i++){ %>
            <tr>
                <td><%= datas[i].user %></td>
                <td><%= datas[i].password %></td>
                <td><%= datas[i].company %></td>
                <td><%= datas[i].name %></td>
                <td><%= datas[i].phone %></td>
                <td>
                    <% if(session.permissionMap[2003]){ %>
                    <a class="btn btn-sm btn-default" href="/user/edit?id=<%= datas[i]._id %>">编辑</a>
                    <% } %>
                    <% if(session.permissionMap[2002]){ %>
                    <a class="btn btn-sm btn-danger" href="/user/remove?buyerid=<%= datas[i]._id %>"
                       onclick="return confirm('确定删除该用户?')">删除</a>
                    <% } %>
                </td>
            </tr>
            <% } %>
        </table>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        //分页功能
        $('.twbsPagination').twbsPagination({
            totalPages: <%= page.pageCount %>,
            visiblePages: 10,
            href: '/user/list?num={{number}}'
        });
    })
</script>